home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Science / RLaB / help / rand < prev    next >
Text File  |  1994-04-25  |  3KB  |  120 lines

  1. rand:
  2.  
  3. Syntax:    rand ( )
  4.     rand ( nrow , ncol )
  5.  
  6.     rand ( "type" )
  7.     rand ( "type" , d1 )
  8.     rand ( "type" , d1 , d2 )
  9.  
  10. Description:
  11.  
  12.     rand() creates a random scalar, or matrix.
  13.  
  14.     `rand()' produces a random scalar.
  15.  
  16.     `rand ( X , Y )' produces a randomly generated MATRIX with row
  17.     dimension X, and column dimension Y.
  18.  
  19.     `rand ( "type" , ... )' changes the distribution used when
  20.     generating random numbers. The value of type determines the
  21.     subsequent parameters.
  22.  
  23.     type:
  24.  
  25.     rand( "beta" , A , B )
  26.  
  27.     Returns a single random deviate from the beta distribution
  28.     with parameters A and B.  The density of the beta is
  29.                x^(a-1) * (1-x)^(b-1) / B(a,b) for 0 < x < 1
  30.  
  31.     rand ( "chi" , DF )
  32.  
  33.     Generates random deviate from the distribution of a chi-square
  34.     with DF degrees of freedom random variable.
  35.  
  36.     rand ( "exp" , AV )
  37.  
  38.     Generates a single random deviate from an exponential
  39.     distribution with mean AV.
  40.     
  41.     rand ( "f" , DFN  DFD )
  42.  
  43.     Generates a random deviate from the F (variance ratio)
  44.     distribution with DFN degrees of freedom in the numerator and
  45.     DFD degrees of freedom in the denominator.
  46.  
  47.     rand ( "gamma" , A , R )
  48.  
  49.     Generates random deviates from the gamma distribution whose
  50.     density is 
  51.         (A**R)/Gamma(R) * X**(R-1) * Exp(-A*X)
  52.  
  53.     rand ( "nchi" , DF , XNONC )
  54.  
  55.     Generates random deviate from the distribution of a noncentral
  56.     chi-square with DF degrees of freedom and noncentrality
  57.     parameter XNONC.
  58.  
  59.     rand ( "nf" , DFN , DFD, XNONC )
  60.  
  61.     Generates a random deviate from the noncentral F (variance
  62.     ratio)     distribution with DFN degrees of freedom in the
  63.     numerator, and DFD degrees of freedom in the denominator, and
  64.     noncentrality parameter XNONC.
  65.  
  66.     rand ( "normal" , AV , SD )
  67.  
  68.     Generates a single random deviate from a normal distribution
  69.     with mean, AV, and standard deviation, SD.
  70.  
  71.     rand ( "uniform" , LOW , HIGH )
  72.  
  73.     Generate Uniform double between LOW and HIGH
  74.  
  75.     rand ( "bin" , N , P )
  76.  
  77.     Returns a single random deviate from a binomial distribution
  78.     whose number of trials is N and whose probability of an event
  79.     in each trial is P. 
  80.  
  81.     rand ( "poisson" , AV )
  82.  
  83.     Generates a single random deviate from a Poisson distribution
  84.     with mean AV. 
  85.  
  86.     rand ( "default" )
  87.  
  88.     Resets the random number generator to the default generator,
  89.     which generates a distributed random variable in the interval
  90.     0 -> 1. The interval endpoints are not returned.
  91.  
  92.     Examples:
  93.  
  94.     > rand()
  95.            0.368
  96.     > rand(4)
  97.      vector elements 1 thru 4
  98.            0.983       0.535       0.766       0.646
  99.     > rand(3,3)
  100.      matrix columns 1 thru 3
  101.            0.767       0.152       0.347
  102.             0.78       0.625       0.917
  103.            0.823       0.315        0.52
  104.  
  105.  
  106.     > rand("norm", 10.0, 2.0 );
  107.     > rand(10)
  108.      vector elements 1 thru 5
  109.             9.86        11.8        12.1        7.35        8.76
  110.      vector elements 6 thru 10
  111.             10.5        7.44        11.1        6.93        9.87
  112.  
  113.  
  114.     rand() uses the RANLIB library, authored by B. W. Brown and 
  115.     J. Lovato under grant CA-16672 from the National Cancer
  116.     Institute. 
  117.  
  118.  
  119. See Also: srand
  120.